home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Floppyshop 2
/
Floppyshop - 2.zip
/
Floppyshop - 2.iso
/
diskmags
/
0022-3.564
/
dmg-3451
/
data
/
dosdisp.dat
< prev
next >
Wrap
Text File
|
1987-04-21
|
4KB
|
149 lines
A basic doc-display routine.
By Wheee the fibble.
Ok, this is a little program to display any doc files you
want to read but can't be bothered exiting from STOS. I make no
claims about reliablility or anything else, but it gets the job
done. Ok, on with the listing...
10 key off : hide : flash off : click off : mode 1 : curs off : auto back off
: update off
Set up the screen and things (assume not in High res)
12 palette $222,$444
Set up the palette to the colours my STOS is in usually
(lovely)
15 dim TT$(1000)
Array to hold the lines of text. If the docs you're going to
be displaying are likely to be longer than 1000 lines then
increase the size of this array.
17 call start(15)+28 : wait vbl
Start up the music (which is from The Syntax Terror Demo and
was written by Mad Max)
20 clw : home : curs off : home : centre "Very basic doc display routine"
: print : centre "By Wheee the fibble"
Clear the screen, print the crap...
25 show on : F$=file select$("*.*","Load a doc",4) : if F$="" then
call start(15)+28 : default : end
Get the filename. If there's no filename then turn off the
music and quit.
26 hide on : locate 0,10 : centre "Loading..." : print :
centre "Use cursor up/down to move pages"
Print up some more crap...
30 open in #1,F$ : L=lof(#1)
Open the file and get it's length.
35 on error goto 45
Set up an error check as some docs don't have EOF-flags or
it may not be a standard ASCII file (1st Word, ST Writer or
whatever).
40 T=0 : while not(eof(#1)) : line input #1,TT$(T) : goto 46
Read in a line of the doc and check for the end of the file.
Then skip line 45.
45 resume 46
This is for the on error statement on line 35
46 inc T : wend
Read all the lines until the while is satisfied (no error
check for too many lines).
50 close #1
Close the file.
55 on error goto 10000
Reset the on error command.
60 NLN=T-22 : PG=0
NLN is the number of lines in the whole doc.
PG is the current controlling line number (the one at the top
of the page)
65 rem
A very useful remark
66 hide on : curs off
Mouse + cursor off
70 repeat
Set up loop
75 clw : home : curs off
Clear screen, cursor off.
80 for T=PG to PG+21
Loop from the PG (the top line) for 22 lines of text
90 if T<=NLN+21 then print TT$(T)
If it hasn't gone past the end of the doc, then print the
line up.
100 next T
And do it 22 times.
110 repeat : G$=upper$(inkey$) : S=scancode : until S=72 or S=80 or G$="Q"
Wait until either curs up, curs down or Q is pressed.
130 if S=72 and PG>0 then PG=PG-21 : goto 150
Curs up pressed, so if it isn't at the top of the doc,
decrease PG (the top line) by 21.
140 if S=80 and PG<NLN then PG=PG+21 : goto 150
Same for curs down (page down).
145 if G$<>"Q" then goto 110
If the key pressed wasn't Q the go back and get a key (I'm
not sure why this is here actually, but it might be needed).
150 until G$="Q"
Repeat until Q is pressed.
160 goto 20
Jump back to the file-selector.
10000 print "Error number";errn;" on line";errl
10010 end
Error trap.
note from editor: This Doc Displayer isn't a patch on my amazing
Teetotal text displayer (he says smugly)